package com.cjzuji.rental.Config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
 * @author bag
 * @version V1.0
 * @date 2025/6/12 16:14
 * @since 1.0
 *
 * 文档配置类
 */

// 标明是配置类
@Configuration
// 开启Swagger功能
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                // 指定要扫描的 Controller 包路径
                .apis(RequestHandlerSelectors.basePackage("com.cjzuji.rental"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("API 文档")
                .description("这是项目的 API 文档")
                .version("1.0")
                .build();
    }


}